<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>语雀+Hexo+serverless云函数自动同步 | 小灰灰博客</title><meta name="keywords" content="云函数,hexo,语雀,自动发布"><meta name="author" content="小灰灰"><meta name="copyright" content="小灰灰"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="一、搭建 Hexo 博客本文针对已经搭建好 hexo 博客的，如果没有搭好正常的 hexo 博客的可以去看另一篇博文，搭建很方便的。使用 hexo 搭建博客地址：https:&#x2F;&#x2F;www.yuque.com&#x2F;xianrenqh&#x2F;kyeqhg&#x2F;xo8csy 二、Hexo 同步语雀内容用到了这个项目：  https:&#x2F;&#x2F;github.com&#x2F;x-cold&#x2F;yuque-hexo   安装：npm i -g">
<meta property="og:type" content="article">
<meta property="og:title" content="语雀+Hexo+serverless云函数自动同步">
<meta property="og:url" content="https://www.xiaohuihui.net/posts/ec39ff9.html">
<meta property="og:site_name" content="小灰灰博客">
<meta property="og:description" content="一、搭建 Hexo 博客本文针对已经搭建好 hexo 博客的，如果没有搭好正常的 hexo 博客的可以去看另一篇博文，搭建很方便的。使用 hexo 搭建博客地址：https:&#x2F;&#x2F;www.yuque.com&#x2F;xianrenqh&#x2F;kyeqhg&#x2F;xo8csy 二、Hexo 同步语雀内容用到了这个项目：  https:&#x2F;&#x2F;github.com&#x2F;x-cold&#x2F;yuque-hexo   安装：npm i -g">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://www.xiaohuihui.net/img/default_list2.jpg">
<meta property="article:published_time" content="2022-04-07T21:37:45.000Z">
<meta property="article:modified_time" content="2022-04-11T03:52:48.360Z">
<meta property="article:author" content="小灰灰">
<meta property="article:tag" content="云函数">
<meta property="article:tag" content="hexo">
<meta property="article:tag" content="语雀">
<meta property="article:tag" content="自动发布">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://www.xiaohuihui.net/img/default_list2.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://www.xiaohuihui.net/posts/ec39ff9"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta name="referrer" content="no-referrer"><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?2a44015be196a2b1f38395c5cb4e4ae5";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: {"limitDay":500,"position":"top","messagePrev":"该文章已经发布","messageNext":"天了，自从上次更新以来，文章的内容可能已经过时了。"},
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: true,
    post: true
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"top-right"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '语雀+Hexo+serverless云函数自动同步',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-04-11 11:52:48'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.1.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">8</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">18</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/img/default_list2.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">小灰灰博客</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">语雀+Hexo+serverless云函数自动同步</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-04-07T21:37:45.000Z" title="发表于 2022-04-08 05:37:45">2022-04-08</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-04-11T03:52:48.360Z" title="更新于 2022-04-11 11:52:48">2022-04-11</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%AD%A6%E6%97%A0%E6%AD%A2%E5%A2%83/">学无止境</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.9k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>8分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="语雀+Hexo+serverless云函数自动同步"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="一、搭建-Hexo-博客"><a href="#一、搭建-Hexo-博客" class="headerlink" title="一、搭建 Hexo 博客"></a>一、搭建 Hexo 博客</h1><p>本文针对已经搭建好 hexo 博客的，如果没有搭好正常的 hexo 博客的可以去看另一篇博文，搭建很方便的。<br>使用 hexo 搭建博客地址：<br><a target="_blank" rel="noopener" href="https://www.yuque.com/xianrenqh/kyeqhg/xo8csy">https://www.yuque.com/xianrenqh/kyeqhg/xo8csy</a></p>
<h1 id="二、Hexo-同步语雀内容"><a href="#二、Hexo-同步语雀内容" class="headerlink" title="二、Hexo 同步语雀内容"></a>二、Hexo 同步语雀内容</h1><p>用到了这个项目：</p>
<blockquote>
<p><a target="_blank" rel="noopener" href="https://github.com/x-cold/yuque-hexo">https://github.com/x-cold/yuque-hexo</a></p>
</blockquote>
<blockquote>
<p>安装：npm i -g yuque-hexo</p>
</blockquote>
<p>然后把 package.json 的内容添加上下面这些：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">&quot;yuqueConfig&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">  <span class="attr">&quot;postPath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;source/_posts&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;cachePath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;yuque.json&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;mdNameFormat&quot;</span><span class="punctuation">:</span> <span class="string">&quot;slug&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;adapter&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hexo&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;concurrency&quot;</span><span class="punctuation">:</span> <span class="number">5</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;baseUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://www.yuque.com/api/v2&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;login&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hxfqg9&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;repo&quot;</span><span class="punctuation">:</span> <span class="string">&quot;web&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;token&quot;</span><span class="punctuation">:</span> <span class="string">&quot;语雀token&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;onlyPublished&quot;</span><span class="punctuation">:</span> <span class="keyword">true</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;onlyPublic&quot;</span><span class="punctuation">:</span> <span class="keyword">true</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="attr">&quot;devDependencies&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">  <span class="attr">&quot;yuque-hexo&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.6.0&quot;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="attr">&quot;hexo&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">  <span class="attr">&quot;version&quot;</span><span class="punctuation">:</span> <span class="string">&quot;4.2.1&quot;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>这里需要说明：<br>baseurl 是固定的<br>login 和 repo 是如下图这样对应的，个人界面和团队界面都可以<br><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2022/png/27022430/1649396601747-fc1e332a-2b6a-4ad0-bf0b-85b45608f17b.png#clientId=udcfe64c5-982a-4&crop=0&crop=0&crop=1&crop=1&from=paste&id=u0d64e7b4&margin=%5Bobject%20Object%5D&name=image.png&originHeight=545&originWidth=1080&originalType=url%E2%88%B6=1&rotation=0&showTitle=false&size=189765&status=done&style=none&taskId=u57aea17f-fb57-435f-8a44-af6dbe6c1cc&title=" alt="image.png"></p>
<p>token 是在右上角头像 -&gt; 账户设置 -&gt; Token 添加的，权限的话只给读取就可以<br>ps.公开的知识库也要设置 Token。<br>接着，<br>在 “scripts” 中添加</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&quot;sync&quot;: &quot;yuque-hexo sync&quot;,</span><br><span class="line">&quot;clean:yuque&quot;: &quot;yuque-hexo clean&quot;,</span><br></pre></td></tr></table></figure>

<p>这样整体下来我的 package.json 内容如下（参考）：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">  <span class="attr">&quot;name&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hexo-site&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;version&quot;</span><span class="punctuation">:</span> <span class="string">&quot;0.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;private&quot;</span><span class="punctuation">:</span> <span class="keyword">true</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;scripts&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;build&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hexo generate&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;clean&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hexo clean&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;deploy&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hexo deploy&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;server&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hexo server&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;sync&quot;</span><span class="punctuation">:</span> <span class="string">&quot;yuque-hexo sync&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;clean:yuque&quot;</span><span class="punctuation">:</span> <span class="string">&quot;yuque-hexo clean&quot;</span></span><br><span class="line">  <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;yuqueConfig&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;postPath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;source/_posts&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;cachePath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;yuque.json&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;mdNameFormat&quot;</span><span class="punctuation">:</span> <span class="string">&quot;slug&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;adapter&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hexo&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;concurrency&quot;</span><span class="punctuation">:</span> <span class="number">5</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;baseUrl&quot;</span><span class="punctuation">:</span> <span class="string">&quot;https://www.yuque.com/api/v2&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;login&quot;</span><span class="punctuation">:</span> <span class="string">&quot;hxfqg9&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;repo&quot;</span><span class="punctuation">:</span> <span class="string">&quot;web&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;token&quot;</span><span class="punctuation">:</span> <span class="string">&quot;语雀token&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;onlyPublished&quot;</span><span class="punctuation">:</span> <span class="keyword">true</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;onlyPublic&quot;</span><span class="punctuation">:</span> <span class="keyword">true</span></span><br><span class="line">  <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;devDependencies&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;yuque-hexo&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.6.0&quot;</span></span><br><span class="line">  <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;hexo&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;version&quot;</span><span class="punctuation">:</span> <span class="string">&quot;4.2.1&quot;</span></span><br><span class="line">  <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">  <span class="attr">&quot;dependencies&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;hexo&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^4.2.1&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-deployer-git&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^2.1.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-archive&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-baidu-sitemap&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^0.1.6&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-category&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-feed&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^2.2.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-index&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-json-content&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^4.2.3&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-searchdb&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.3.1&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-sitemap&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^2.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-generator-tag&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-renderer-ejs&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-renderer-marked&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^2.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-renderer-stylus&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.1.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-server&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^1.0.0&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;hexo-wordcount&quot;</span><span class="punctuation">:</span> <span class="string">&quot;^6.0.1&quot;</span></span><br><span class="line">  <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>

<p>这时候，在本地调试的时候使用命令：yuque-hexo sync 就会把语雀的文章给下载下来，下载到 \source_posts<br>（使用以上命令前先备份本地的_posts 文件夹下的 md 文章，使用语雀下载的时候会先清空此文件夹）<br>然后 hexo g &amp;&amp; hexo s 就可以访问 127.0.0.1:4000 本地看一下了<br>手动发布是 hexo g &amp;&amp; hexo d</p>
<h3 id="针对语雀图片无法正常显示的解决办法"><a href="#针对语雀图片无法正常显示的解决办法" class="headerlink" title="针对语雀图片无法正常显示的解决办法"></a>针对语雀图片无法正常显示的解决办法</h3><p>在主题的 layout 文件夹中的 post.ejs 文件中加上一句（不同主题加的位置不同）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;meta name=&quot;referrer&quot; content=&quot;no-referrer&quot; /&gt;</span><br></pre></td></tr></table></figure>

<p><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2022/png/27022430/1649404362200-7eafd317-d235-4af8-afe9-4f9c54d4dee2.png#clientId=u68da2bd8-69aa-4&crop=0&crop=0&crop=1&crop=1&from=paste&id=u4d9c66af&margin=%5Bobject%20Object%5D&name=image.png&originHeight=351&originWidth=841&originalType=url%E2%88%B6=1&rotation=0&showTitle=false&size=46710&status=done&style=none&taskId=ufd914241-d133-43ab-b845-e08191199df&title=" alt="image.png"></p>
<p>小灰灰用的是 butterFly 主题，加的位置在：<br>\themes\butterfly\layout\includes\head.pug 文件：<br>大概在第 40 行左右添加：<br>（PS：放在这个位置是因为百度统计的 referrer 问题。只能放在统计后面）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">meta(name=&quot;referrer&quot; content=&quot;no-referrer&quot;)</span><br></pre></td></tr></table></figure>

<p>如图：<br><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2022/png/27022430/1649641758436-1971a415-4efc-45ff-87b9-1e47f9617353.png#clientId=u6e1ca8df-731b-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=700&id=u651955ce&margin=%5Bobject%20Object%5D&name=image.png&originHeight=773&originWidth=1119&originalType=binary%E2%88%B6=1&rotation=0&showTitle=false&size=134271&status=done&style=none&taskId=u1edc2856-0d56-4f15-9454-c218fcf937a&title=&width=1013.4339987353198" alt="image.png"></p>
<h1 id="三、github-actions-自动更新"><a href="#三、github-actions-自动更新" class="headerlink" title="三、github actions 自动更新"></a><strong>三、github actions 自动更新</strong></h1><p>在 github 上创建一个私有仓库（因为会涉及到一些 token 啥的）仓库名字无所谓<strong>（用来存放 hexo 源码）</strong><br><strong>注意</strong>：在仓库里面再放一个仓库是没法把里面那个仓库 push 到 github 的，只会传一个空文件夹，导致后期博客成了空白页面，最简单粗暴的办法就是把你 git clone 的 hexo 主题里的 .git 文件夹给删掉<br>然后在 hexo 的目录下运行如下命令，把 hexo 的源码传到 github 远程仓库中</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">git init</span><br><span class="line">git add .</span><br><span class="line">git commit -m &quot;first commit&quot;</span><br><span class="line">git remote add origin https://github.com/yichen115/blog.git</span><br><span class="line">git push -u origin master</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>去 github 的 settings 创建一个 token （ps:个人中心的设置，非项目的设置）<br><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2022/png/27022430/1649396898326-2a09cbe8-9587-4f19-9f13-ead9e3bd6fc1.png#clientId=udcfe64c5-982a-4&crop=0&crop=0&crop=1&crop=1&from=paste&id=uac4e5e7e&margin=%5Bobject%20Object%5D&name=image.png&originHeight=390&originWidth=1080&originalType=url%E2%88%B6=1&rotation=0&showTitle=false&size=89765&status=done&style=none&taskId=uc2174048-c4a7-45e5-8b7e-a72c318831b&title=" alt="image.png"></p>
<p>只勾上这一个即可：<br><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2022/png/27022430/1649396909568-f0df156b-9310-4954-9350-da49c64404d2.png#clientId=udcfe64c5-982a-4&crop=0&crop=0&crop=1&crop=1&from=paste&id=u1e211b98&margin=%5Bobject%20Object%5D&name=image.png&originHeight=627&originWidth=746&originalType=url%E2%88%B6=1&rotation=0&showTitle=false&size=53298&status=done&style=none&taskId=ua795b964-947a-41ce-bafa-a59b4ecd46b&title=" alt="image.png"><br><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2022/png/27022430/1649396921676-0e84a878-d94d-44d7-bd5b-0d1490dd65c6.png#clientId=udcfe64c5-982a-4&crop=0&crop=0&crop=1&crop=1&from=paste&id=u4cbbdb00&margin=%5Bobject%20Object%5D&name=image.png&originHeight=445&originWidth=1015&originalType=url%E2%88%B6=1&rotation=0&showTitle=false&size=45407&status=done&style=none&taskId=u4adc989a-ec2a-4dcc-9a1d-66a0017e2b1&title=" alt="image.png"></p>
<p><strong>生成了 token 之后一定要记下来</strong>，再回来就没法看了<br>然后来到刚才创建的私有仓库的 settings<br><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2022/png/27022430/1649396944906-f483bf94-9454-4d5b-8fcb-5ad1d02e9003.png#clientId=udcfe64c5-982a-4&crop=0&crop=0&crop=1&crop=1&from=paste&id=u71d114fa&margin=%5Bobject%20Object%5D&name=image.png&originHeight=419&originWidth=1080&originalType=url%E2%88%B6=1&rotation=0&showTitle=false&size=91140&status=done&style=none&taskId=u2e8da352-5627-4745-98cb-0fad22bf7af&title=" alt="image.png"></p>
<p>添加三个 secret<br><strong>GH_REF</strong> 是你博客的仓库地址 github.com&#x2F;<strong>**</strong>&#x2F;<strong>**</strong>.github.io<br>注意去掉前面 https:&#x2F;&#x2F;<br><strong>GE_TOKEN</strong> 是刚才生成的 token<br>然后来到 actions，点击 set up a workflow yourself<br>**HEXO_DEPLOY_PRI **是新增的 ssh 密钥<br>在命令行中输入：</p>
<blockquote>
<p>ssh-keygen -t rsa -C “<a href="mailto:&#121;&#x6f;&#117;&#114;&#x5f;&#x65;&#x6d;&#97;&#x69;&#x6c;&#64;&#101;&#120;&#97;&#x6d;&#x70;&#x6c;&#101;&#x2e;&#x63;&#x6f;&#109;">&#121;&#x6f;&#117;&#114;&#x5f;&#x65;&#x6d;&#97;&#x69;&#x6c;&#64;&#101;&#120;&#97;&#x6d;&#x70;&#x6c;&#101;&#x2e;&#x63;&#x6f;&#109;</a>“</p>
</blockquote>
<p>备注：<br>同时生成的公钥，要放到 Hexo 生成 page 的项目的公钥下面<br>（只有密钥和公钥相互匹配，才能推送静态文件到公开的项目下（page 项目））</p>
<p>编辑内容如下：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">name:</span> <span class="string">Hexo</span> <span class="string">Deploy</span></span><br><span class="line"></span><br><span class="line"><span class="attr">on:</span></span><br><span class="line">  <span class="attr">workflow_dispatch:</span></span><br><span class="line">  <span class="attr">push:</span></span><br><span class="line">    <span class="attr">branches:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">master</span></span><br><span class="line">  <span class="attr">schedule:</span></span><br><span class="line">    <span class="bullet">-</span> <span class="attr">cron:</span> <span class="string">&quot;0 21 * * 0&quot;</span> <span class="comment"># 每周日 UTC 时间 21:00, 北京时间周一凌晨5点</span></span><br><span class="line"></span><br><span class="line"><span class="attr">jobs:</span></span><br><span class="line">  <span class="attr">build:</span></span><br><span class="line">    <span class="attr">runs-on:</span> <span class="string">ubuntu-latest</span></span><br><span class="line"></span><br><span class="line">    <span class="attr">steps:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Checkout</span> <span class="string">source</span> <span class="comment"># 将仓库内master分支的内容下载到工作目录1</span></span><br><span class="line">        <span class="attr">uses:</span> <span class="string">actions/checkout@v2</span> <span class="comment"># 脚本来自 https://github.com/actions/checkout</span></span><br><span class="line">        <span class="attr">with:</span></span><br><span class="line">          <span class="attr">ref:</span> <span class="string">master</span></span><br><span class="line">          <span class="attr">submodules:</span> <span class="string">&quot;true&quot;</span></span><br><span class="line"></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Setup</span> <span class="string">Node</span></span><br><span class="line">        <span class="attr">uses:</span> <span class="string">actions/setup-node@v1</span></span><br><span class="line">        <span class="attr">with:</span></span><br><span class="line">          <span class="attr">node-version:</span> <span class="string">&quot;14.x&quot;</span></span><br><span class="line"></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Checkout</span> <span class="string">Submodules</span></span><br><span class="line">        <span class="attr">run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          auth_header=&quot;$(git config --local --get http.https://github.com/.extraheader)&quot;</span></span><br><span class="line"><span class="string">          git submodule sync --recursive</span></span><br><span class="line"><span class="string">          git -c &quot;http.extraheader=$auth_header&quot; -c protocol.version=2 submodule update --init --force --recursive --depth=1</span></span><br><span class="line"><span class="string"></span></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Setup</span> <span class="string">Hexo</span></span><br><span class="line">        <span class="attr">env:</span></span><br><span class="line">          <span class="attr">HEXO_DEPLOY_PRI:</span> <span class="string">$&#123;&#123;</span> <span class="string">secrets.HEXO_DEPLOY_PRI</span> <span class="string">&#125;&#125;</span></span><br><span class="line">        <span class="attr">run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          mkdir -p ~/.ssh/</span></span><br><span class="line"><span class="string">          echo &quot;$HEXO_DEPLOY_PRI&quot; &gt; ~/.ssh/id_rsa</span></span><br><span class="line"><span class="string">          chmod 700 ~/.ssh</span></span><br><span class="line"><span class="string">          chmod 600 ~/.ssh/id_rsa</span></span><br><span class="line"><span class="string">          ssh-keyscan github.com &gt;&gt; ~/.ssh/known_hosts</span></span><br><span class="line"><span class="string">          git config --global user.email &quot;xianrenqh@163.com&quot;</span></span><br><span class="line"><span class="string">          git config --global user.name &quot;xianrenqh&quot;</span></span><br><span class="line"><span class="string">          npm install hexo-cli -g</span></span><br><span class="line"><span class="string">          npm install yuque-hexo -g</span></span><br><span class="line"><span class="string">          yuque-hexo clean</span></span><br><span class="line"><span class="string">          yuque-hexo sync</span></span><br><span class="line"><span class="string"></span></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Setup</span> <span class="string">Yuque</span> <span class="comment">#更新yuque 拉取的文章到GitHub仓库</span></span><br><span class="line">        <span class="attr">run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          git config --global user.email &quot;xianrenqh@163.com&quot;</span></span><br><span class="line"><span class="string">          git config --global user.name &quot;xianrenqh&quot;</span></span><br><span class="line"><span class="string">          git add .</span></span><br><span class="line"><span class="string">          git commit -m &quot;Refresh yuque json&quot; -a</span></span><br><span class="line"><span class="string"></span></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Push</span> <span class="string">Yuque</span> <span class="comment">#推送修改后的yuque json</span></span><br><span class="line">        <span class="attr">uses:</span> <span class="string">ad-m/github-push-action@master</span></span><br><span class="line">        <span class="attr">with:</span></span><br><span class="line">          <span class="attr">github_token:</span> <span class="string">$&#123;&#123;</span> <span class="string">secrets.GE_TOKEN</span> <span class="string">&#125;&#125;</span></span><br><span class="line"></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Cache</span> <span class="string">Hexo</span></span><br><span class="line">        <span class="attr">uses:</span> <span class="string">actions/cache@v1</span></span><br><span class="line">        <span class="attr">id:</span> <span class="string">cache</span></span><br><span class="line">        <span class="attr">with:</span></span><br><span class="line">          <span class="attr">path:</span> <span class="string">node_modules</span></span><br><span class="line">          <span class="attr">key:</span> <span class="string">$&#123;&#123;runner.OS&#125;&#125;-$&#123;&#123;hashFiles(&#x27;**/package-lock.json&#x27;)&#125;&#125;</span></span><br><span class="line"></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Install</span> <span class="string">dependencies</span></span><br><span class="line">        <span class="attr">if:</span> <span class="string">steps.cache.outputs.cache-hit</span> <span class="type">!=</span> <span class="string">&#x27;true&#x27;</span></span><br><span class="line">        <span class="attr">run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          npm install --save</span></span><br><span class="line"><span class="string"></span></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">Hexo</span> <span class="string">Deploy</span></span><br><span class="line">        <span class="attr">run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          hexo clean</span></span><br><span class="line"><span class="string">          hexo generate</span></span><br><span class="line"><span class="string">          hexo deploy</span></span><br></pre></td></tr></table></figure>

<p>下面那个 user.name 和 user.email 根据自己的情况改一下，注意对齐<br>弄完之后每当 push 或 repository_dispatch 的时候都会自动的进行更新</p>
<h1 id="四、配置-ServerLess-云函数"><a href="#四、配置-ServerLess-云函数" class="headerlink" title="四、配置 ServerLess 云函数"></a>四、配置 ServerLess 云函数</h1><p><a target="_blank" rel="noopener" href="https://www.yuque.com/xianrenqh/kyeqhg/awh8vd?view=doc_embed">Github Action 使用云函数调度服务</a></p>
<h1 id="五、发布博文到服务器（vps）上"><a href="#五、发布博文到服务器（vps）上" class="headerlink" title="五、发布博文到服务器（vps）上"></a>五、发布博文到服务器（vps）上</h1><p>小灰灰使用的是 webhooks 的功能同步推送到服务器上的</p>
<h1 id="⑥、PS："><a href="#⑥、PS：" class="headerlink" title="⑥、PS："></a>⑥、PS：</h1><p>小灰灰的 Hexo 博客地址：<br><a href="https://www.xiaohuihui.net/">https://www.xiaohuihui.net</a></p>
<p>听说使用 github action 执行 ssh 可能会出现封号的情况，所以小灰灰的博客代码直接使用自己的服务器搭建的，然后加个 webhook 到语雀上，这样语雀更新之后请求 webhook 执行命令直接在服务器上更新了。<br>宝塔的 webhook 代码：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">#!/bin/bash</span><br><span class="line">echo &quot;&quot;</span><br><span class="line">#输出当前时间</span><br><span class="line">date --date=&#x27;0 days ago&#x27; &quot;+%Y-%m-%d %H:%M:%S&quot;</span><br><span class="line">echo &quot;Start&quot;</span><br><span class="line">cd &quot;/www/wwwroot/你的hexo源码地址&quot;</span><br><span class="line"></span><br><span class="line">echo &quot;清除缓存&quot;</span><br><span class="line">#npx hexo clean</span><br><span class="line"></span><br><span class="line">echo &quot;开始下载语雀文章.....&quot;</span><br><span class="line">npx yuque-hexo sync</span><br><span class="line"></span><br><span class="line">echo &quot;创建文章&quot;</span><br><span class="line">npx hexo g</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">echo &quot;完成&quot;</span><br><span class="line">exit</span><br><span class="line">fi</span><br></pre></td></tr></table></figure>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://www.xiaohuihui.net">小灰灰</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://www.xiaohuihui.net/posts/ec39ff9.html">https://www.xiaohuihui.net/posts/ec39ff9.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://www.xiaohuihui.net" target="_blank">小灰灰博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E4%BA%91%E5%87%BD%E6%95%B0/">云函数</a><a class="post-meta__tags" href="/tags/hexo/">hexo</a><a class="post-meta__tags" href="/tags/%E8%AF%AD%E9%9B%80/">语雀</a><a class="post-meta__tags" href="/tags/%E8%87%AA%E5%8A%A8%E5%8F%91%E5%B8%83/">自动发布</a></div><div class="post_share"><div class="social-share" data-image="/img/default_list2.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/eb656981.html"><img class="prev-cover" src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fgitee.com%2Fwangbowen97%2FBlogImgs%2Fraw%2Fmaster%2FpostImages%2FHexoCover.jpg&amp;refer=http%3A%2F%2Fgitee.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1652059164&amp;t=ac7f746ad7621718ece964ce547ba635" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">使用Hexo搭建博客</div></div></a></div><div class="next-post pull-right"><a href="/posts/3c85ac91.html"><img class="next-cover" src= "" data-lazy-src="https://tse1-mm.cn.bing.net/th/id/R-C.5660045af32fb6185303af27f36acf0d?rik=8qDr8OVk%2fmSILA&amp;riu=http%3a%2f%2fblog-images.qiniu.wqf31415.xyz%2fgithub_action_3.png&amp;ehk=ZPqfDfyFjW6CUcyKK4prggpXliv5%2f907uHUt%2b371uZ8%3d&amp;risl=&amp;pid=ImgRaw&amp;r=0" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Github Action 使用云函数调度服务</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/3c85ac91.html" title="Github Action 使用云函数调度服务"><img class="cover" src= "" data-lazy-src="https://tse1-mm.cn.bing.net/th/id/R-C.5660045af32fb6185303af27f36acf0d?rik=8qDr8OVk%2fmSILA&riu=http%3a%2f%2fblog-images.qiniu.wqf31415.xyz%2fgithub_action_3.png&ehk=ZPqfDfyFjW6CUcyKK4prggpXliv5%2f907uHUt%2b371uZ8%3d&risl=&pid=ImgRaw&r=0" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-04-08</div><div class="title">Github Action 使用云函数调度服务</div></div></a></div><div><a href="/posts/6220e42c.html" title="Hexo使用ButterFly主题"><img class="cover" src= "" data-lazy-src="/img/default_list.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-04-09</div><div class="title">Hexo使用ButterFly主题</div></div></a></div><div><a href="/posts/eb656981.html" title="使用Hexo搭建博客"><img class="cover" src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fgitee.com%2Fwangbowen97%2FBlogImgs%2Fraw%2Fmaster%2FpostImages%2FHexoCover.jpg&refer=http%3A%2F%2Fgitee.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652059164&t=ac7f746ad7621718ece964ce547ba635" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-04-08</div><div class="title">使用Hexo搭建博客</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">小灰灰</div><div class="author-info__description">小灰灰的精神驿站</div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">8</div></a></div><div class="card-info-data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">18</div></a></div><div class="card-info-data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://www.xiaohuihui.net.cn"><i class="fab fa-gitee"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/xianrenqh/huihui-blog-hexo" target="_blank" title=""><i class="fab fa-gitee"></i></a><a class="social-icon" href="mailto:762229008@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">Welcome To My Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content is-expand"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%80%E3%80%81%E6%90%AD%E5%BB%BA-Hexo-%E5%8D%9A%E5%AE%A2"><span class="toc-number">1.</span> <span class="toc-text">一、搭建 Hexo 博客</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BA%8C%E3%80%81Hexo-%E5%90%8C%E6%AD%A5%E8%AF%AD%E9%9B%80%E5%86%85%E5%AE%B9"><span class="toc-number">2.</span> <span class="toc-text">二、Hexo 同步语雀内容</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%92%88%E5%AF%B9%E8%AF%AD%E9%9B%80%E5%9B%BE%E7%89%87%E6%97%A0%E6%B3%95%E6%AD%A3%E5%B8%B8%E6%98%BE%E7%A4%BA%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95"><span class="toc-number">2.0.1.</span> <span class="toc-text">针对语雀图片无法正常显示的解决办法</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%89%E3%80%81github-actions-%E8%87%AA%E5%8A%A8%E6%9B%B4%E6%96%B0"><span class="toc-number">3.</span> <span class="toc-text">三、github actions 自动更新</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%9B%9B%E3%80%81%E9%85%8D%E7%BD%AE-ServerLess-%E4%BA%91%E5%87%BD%E6%95%B0"><span class="toc-number">4.</span> <span class="toc-text">四、配置 ServerLess 云函数</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BA%94%E3%80%81%E5%8F%91%E5%B8%83%E5%8D%9A%E6%96%87%E5%88%B0%E6%9C%8D%E5%8A%A1%E5%99%A8%EF%BC%88vps%EF%BC%89%E4%B8%8A"><span class="toc-number">5.</span> <span class="toc-text">五、发布博文到服务器（vps）上</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E2%91%A5%E3%80%81PS%EF%BC%9A"><span class="toc-number">6.</span> <span class="toc-text">⑥、PS：</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/adb47c67.html" title="MySQL常用语句"><img src= "" data-lazy-src="https://www.sxkawzp.cn/upload/2020/2/mysql1-12a849f2afe54669a6cc3259e9d380ac.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="MySQL常用语句"/></a><div class="content"><a class="title" href="/posts/adb47c67.html" title="MySQL常用语句">MySQL常用语句</a><time datetime="2022-04-10T18:46:44.000Z" title="发表于 2022-04-11 02:46:44">2022-04-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/e8f88cd9.html" title="php json 处理gbk转码utf-8问题（ json_encode转换数组，值为null）"><img src= "" data-lazy-src="/img/default_list.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="php json 处理gbk转码utf-8问题（ json_encode转换数组，值为null）"/></a><div class="content"><a class="title" href="/posts/e8f88cd9.html" title="php json 处理gbk转码utf-8问题（ json_encode转换数组，值为null）">php json 处理gbk转码utf-8问题（ json_encode转换数组，值为null）</a><time datetime="2022-04-10T18:44:16.000Z" title="发表于 2022-04-11 02:44:16">2022-04-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/9bca3d9a.html" title="宝塔WebHook拉取git命令"><img src= "" data-lazy-src="/img/default_list2.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="宝塔WebHook拉取git命令"/></a><div class="content"><a class="title" href="/posts/9bca3d9a.html" title="宝塔WebHook拉取git命令">宝塔WebHook拉取git命令</a><time datetime="2022-04-08T17:45:10.000Z" title="发表于 2022-04-09 01:45:10">2022-04-09</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/6220e42c.html" title="Hexo使用ButterFly主题"><img src= "" data-lazy-src="/img/default_list.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Hexo使用ButterFly主题"/></a><div class="content"><a class="title" href="/posts/6220e42c.html" title="Hexo使用ButterFly主题">Hexo使用ButterFly主题</a><time datetime="2022-04-08T17:29:05.000Z" title="发表于 2022-04-09 01:29:05">2022-04-09</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/eb656981.html" title="使用Hexo搭建博客"><img src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fgitee.com%2Fwangbowen97%2FBlogImgs%2Fraw%2Fmaster%2FpostImages%2FHexoCover.jpg&amp;refer=http%3A%2F%2Fgitee.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1652059164&amp;t=ac7f746ad7621718ece964ce547ba635" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="使用Hexo搭建博客"/></a><div class="content"><a class="title" href="/posts/eb656981.html" title="使用Hexo搭建博客">使用Hexo搭建博客</a><time datetime="2022-04-07T21:39:46.000Z" title="发表于 2022-04-08 05:39:46">2022-04-08</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2021 - 2022 By 小灰灰</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi, welcome to my <a target="_blank" rel="noopener" href="https://xiaohuihui.net/">blog</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">本地搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'bfiqRSFKXN6o264vo900neYc-gzGzoHsz',
      appKey: '2SaEN1fWOUIqba7jlD1i9G9B',
      avatar: 'monsterid',
      serverURLs: 'https://bfiqrsfk.lc-cn-n1-shared.com',
      emojiMaps: "",
      path: window.location.pathname,
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !true) {
  if (true) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><script src="/js/Lete.js"></script><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js" size="150" alpha="0.3" zIndex="-1" mobile="true" data-click="false"></script><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>